function loadConfig() {
  fetch('/config')
    .then(response => response.json())
    .then(data => {
      if(data.success) {
        const jsonString = JSON.stringify(data.config, null, 2);
        const highlighted = jsonString
          .replace(/"(w+)":/g, '<span class="json-key">"$1":</span>')
          .replace(/: ("[^"]*")/g, ': <span class="json-string">$1</span>')
          .replace(/: (\d+\.?\d*)/g, ': <span class="json-number">$1</span>')
          .replace(/: (true|false)/g, ': <span class="json-boolean">$1</span>')
          .replace(/: null/g, ': <span class="json-null">null</span>');

        document.getElementById('config-data').innerHTML = highlighted;
        document.getElementById('config-modal').style.display = 'block';
      }
    });
}

function closeConfig() {
  document.getElementById('config-modal').style.display = 'none';
}